<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Vue 实现 todo-list</title>
  <!-- <script src="https://cdn.bootcss.com/vue/2.5.16/vue.js"></script> -->
  <script src="./vue-2.15.13.js"></script>

</head>
<body>
  <div id="app">
    <input type="text" v-model="title">
    <button @click="add">submit</button>
    <div>
      <ul>
        <li v-for="item in list">{{ item }}</li>
      </ul>
    </div>
  </div>

  <script>
    var vm = new Vue({
      el: '#app',
      data: {
        title: '',
        list: []
      },
      methods: {
        add: function() {
          if(this.title) {
            this.list.push(this.title)
            this.title = ''
          }
        }
      }

    })
  </script>
</body>
</html>